package com.briup.jz.web.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.briup.jz.bean.Platform;
import com.briup.jz.service.IPlatformService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("Platform")
@Api(description="平台账户信息")
@Validated
public class PlatformController {
	@Autowired
	private IPlatformService plat;
	
	@GetMapping("/findAll")
	@ApiOperation("查找所有")
	public List<Platform> findAll(){
		return plat.findAll();
	}
	@GetMapping("/findById")
	@ApiOperation("根据id查询账户")
	@ApiImplicitParam(name="id",value="主键",dataType="long",paramType="query",required=true)
	public Platform findById(Long id) {
		return plat.findById(id);
	}
	@GetMapping("/deleteById")
	@ApiOperation("根据id删除")
	@ApiImplicitParam(name="id",value="id",dataType="long",paramType="query",required=true)
	public void deleteById(Long id) {
		plat.delete(id);
	}
	@GetMapping("/saveOrUpdate")
	@ApiOperation(value="保存或者更新",notes="有id就更新，无id就保存")
	public void saveOrUpdate(Platform p) {
		plat.saveOrUdate(p);
	}
}
